package com.fannyxie.linkup
{
	import flash.display.Graphics;
	
	import mx.core.UIComponent;
	import mx.effects.*;

	public class Utils
	{
		public static var UP:int = 1;
		public static var RIGHT:int = 2;
		public static var DOWN:int = 3;
		public static var LEFT:int = 4;
		
		public function Utils()
		{
		}
		
		public static function drawLine(component:UIComponent, xto:Number, yto:Number, xfrom:Number, yfrom:Number, color:Number, size:Number = 1):void
		{
			trace("from: x:"+xfrom+", y:"+yfrom);
			trace("to: x:"+xto+", y:"+yto);
			component.graphics.lineStyle(size, color);
			component.graphics.moveTo(xfrom, yfrom);
			component.graphics.lineTo(xto, yto);
		}
		
		
		
		public static function getDirection(direction:int):String{
			switch(direction){
				case 1:
					return "UP";
				case 2:
					return "RIGHT";
				case 3:
					return "DOWN";
				case 4:
					return "LEFT";
			}
			return null;
		}
		
		public static function getFadeInstance(alphaFrom:Number=0, alphaTo:Number=1, duration:Number=500):Fade
		{
			var fade:Fade = new Fade();
			fade.alphaFrom = alphaFrom;
			fade.alphaTo = alphaTo;
			fade.duration = duration;
			return fade;
		}
		
	}
}